// 路由配置信息
export default [
    {
        path: '/portal',
        component: () => import("@/views/Layout"),
        children: [
            {
                path: '',
                component: () => import('@/views/Home'),
            },
            {
                path: '/search/:value',
                component: () => import('@/views/Search')
            },
            {
                path: '/category/:id',
                component: () => import('@/views/Category')
            },
            {
                path: '/category/sub/:id',
                component: () => import('@/views/SubCategory')
            },
            {
                path: '/detail/:id',
                component: () => import("@/views/Detail")
            },
            {
                path: '/cartlist',
                component: () => import("@/views/CartList")
            },
            {
                path: '/checkout',
                component: () => import("@/views/Checkout")
            },
            {
                path: '/pay',
                component: () => import("@/views/Pay"),
                beforeEnter: (to, from, next) => {
                    if(from.path=='/checkout'){
                        next();
                    }else{
                        next(false)
                    }
                }
            },
            {
                path: '/paycallback', // 注意路径，必须是paycallback
                component: () => import("@/views/PayBack"),
                beforeEnter: (to, from, next) => {
                    if(from.path=='/pay'){
                        next();
                    }else{
                        next(false)
                    }
                }
            },
            {
                path: '/member',
                component: () => import('@/views/Member'),
                children: [
                    {
                        path: 'user',
                        component: () => import('@/views/Member/components/UserInfo.vue')
                    },
                    {
                        path: 'order',
                        component: () => import('@/views/Member/components/UserOrder.vue')
                    },
                    {
                        path: '',
                        redirect: '/member/user'
                    }
                ]
            }
        ]
    },

    {
        path: '/login',
        component: () => import("@/views/Login"),
    },

    {
        path: '/manager',
        redirect: "/user",
        component: () => import('@/views/main.vue'),
        children:[
            {
                path: '/user',
                component: () => import( '@/views/user'),
            },
            {
                path: '/orderManagement',
                component: () => import( '@/views/order')
            },
            {
                path: '/goodsManagement',
                component: () => import( '@/views/goods')
            },
            {
                path: '/typeManagement',
                component: () => import( '@/views/medicineType')
            }
        ]
    },

    {
        path: '/reg',
        component: () => import(/* webpackChunkName: "about" */ '@/views/register.vue')
    },
    {
        path: '/myInfo',
        name: 'myInfo',
        component: () => import(/* webpackChunkName: "about" */ '@/views/user/myInfo.vue')
    },
]
